<template>
    <div>
        <div class="category-content">
            <h2 class="title">添加分类：</h2>
            <form class="form" autocomplete="off">
                <ul class="list-ul">
                    <li class="list-li">
                        <label>分类名称</label>
                        <input type="text" v-validate="'required'" v-model="name" name="name" placeholder="请填写分类名称" style="width: 7rem;">
                    </li>
                    <li class="list-li">
                        <label>分类备注</label>
                        <input type="text" v-validate="'required'" v-model="remark" name="remark" placeholder="请填写分类备注">
                    </li>
                </ul>
                <div class="btndiv">
                    <input type="button" value="提交" @click="addcate">
                </div>
            </form>
        </div>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                name: "",
                remark: ""
            }
        },
        methods: {
            addcate: function () {
                if (this.name == "" || this.remark == "") {
                    layer.msg("对不起不能为空")
                } else {
                    this.$http.post(this.APIURL_PREFIX + '/api/wap/goodsTypeCustom', $.param({ name: this.name, remark: this.remark })).then((response) => {
                        console.log(response.data);
                        layer.msg("添加成功!");
                        this.$router.push({ name: 'Business_category_ad' })
                    }).catch(function (err) {
                        console.log(err);
                        layer.msg("添加失败");
                    });
                }
            }
        },
        mounted() {
        },
        components: {
        }
    }
</script>
<style scoped>
    body {
        background-color: #FFFFFF;
    }

    .title {
        height: 2rem;
        text-align: left;
        line-height: 2rem;
        font-size: 0.85rem;
        color: #000000;
        padding-left: 0.5rem;
    }

    .list-ul {
        width: 100%;
        overflow: hidden;
    }

    .list-li {
        width: 100%;
        height: 2.5rem;
        line-height: 2.5rem;
        display: flex;
        border-bottom: 1px solid #e5e5e5;
    }

        .list-li label {
            margin-right: auto;
            margin-left: 0.5rem;
        }

        .list-li input {
            background: none;
            border: none;
            font-size: 14px;
            line-height: 2.5rem;
            text-align: right;
            padding: 0;
            margin: 0;
            height: 2.5rem;
            padding-right: 0.5rem;
            width: 15rem;
        }

    .btndiv input {
        display: block;
        width: 80%;
        height: 2.5rem;
        background: #ff0808;
        color: #ffffff;
        margin: 0 auto;
        margin-top: 3rem;
        border: none;
    }
</style>
